<template>
	<view>
		<view class="nav">
			<uni-icons type="arrowleft" @click="go2"></uni-icons>账号登录
		</view>
		<view class="message">
			<view class="detail">
				<input type="text" placeholder="邮箱号" v-model="login_user">
			</view>
			<view class="detail">
				<input type="safe-password" password="true" placeholder="请输入密码" v-model="login_pass">
			</view>
		</view>
		<view class="message2">
			<text class="tip">忘记密码？</text>
			<text class="tip" @click="reg">注册账号</text>
		</view>
		<view class="message3">
			<button class="button" @click="login">登录</button>
		</view>
	</view>
</template>

<script>
	import http from '../../utils/http'
	export default {
		data() {
			return {
				login_user: '',
				login_pass: ''
			}
		},
		methods: {
			login() {
				http({
					method: 'post',
					url: `/user/login`,
					data: {
						useremail: this.login_user,
						userPWD: this.login_pass

					},
					success: (res) => {
						// console.log(res.data.data.userId)
						uni.setStorageSync('userId',res.data.data.userId)
						uni.showToast({
							titile: '登录成功',
							icon: 'success'
						});
						uni.switchTab({
							url: '/pages/mine/mine'
						});
					}

				})
			},
			go2() {
				uni.navigateTo({
					url: '/pages/mine/login1'
				})
			},
			reg() {
				uni.navigateTo({
					url: '/pages/mine/register1'
				})
			}
		}
	}
</script>

<style>
	.nav {
		margin-top: 10%;
		font-family: YouYuan;
	}

	.message {
		margin-top: 20%;
	}

	.message2 {
		/* margin-top: 8%;
	margin-left: 5%; */
		display: flex;
		justify-content: space-around;
		align-items: flex-start;
	}

	.message3 {
		margin-top: 22%;
	}

	.detail input {
		margin-left: 40rpx;
		font-size: 32rpx;
		width: 400rpx;
	}

	.tip {
		color: #41c20c;
		text-decoration: underline;
		margin-top: 20%;
		font-size: 30rpx;
	}

	.detail {
		display: flex;
		height: 100rpx;
		align-items: center;
		border-bottom: 1px solid rgba(238, 238, 238, 1);
		margin-left: 30rpx;
		padding-right: 30rpx;
	}

	.button {
		margin-top: 15rpx;
		text-align: center;
		line-height: 86rpx;
		width: 600rpx;
		height: 86rpx;
		border-radius: 30px;
		background-color: #41c20c;
		color: white;
		font-size: 14px;
	}
</style>
